from sklearn.cluster import KMeans
from demo import show_plt

# 创建一个示例数据集
data = [[2, 5], [1, 4], [3, 6], [8, 2], [7, 3], [6, 4]]

kmeans = KMeans(n_clusters=2)
# 训练模型并进行聚类
kmeans.fit(data)
# 输出每个样本所属的簇标签
labels = kmeans.labels_
print(labels)
show_plt(data,kmeans.cluster_centers_)
